import { _decorator, Component } from 'cc';

import Config from './Config';

export default class PokerData {

    public static cardNo = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10","J", "Q", "K", "小", "大"];

    setPokerData() {
        for (let i = 0; i < PokerData.cardNo.length; i++) {
            if (i < PokerData.cardNo.length - 2) {
                for (const key in Config.pokerCardType) {
                    var pokerDataItem = {
                        showTxt: PokerData.cardNo[i],
                        showType: Config.pokerCardType[key]
                    }
                    PokerData.showData.push(pokerDataItem)
                }
            }else {
                switch (i) {
                    case 13:
                        var pokerDataItem = {
                            showTxt: PokerData.cardNo[i],
                            showType: Config.ghostCardType.bigG
                        }
                        PokerData.showData.push(pokerDataItem)
                        break;
                    case 14:
                        var pokerDataItem = {
                            showTxt: PokerData.cardNo[i],
                            showType: Config.ghostCardType.smallG
                        }
                        PokerData.showData.push(pokerDataItem)
                        break;
                }
            }
            
        }
    }
    
    GetPokerData(){
        PokerData.getPokerData = function(){
            return PokerData.showData;
        }
    }

    CreatePoker(){

        var PokerData = {}
        PokerData.cardNo = ["A", "2", "3", "4", "5", "6", "7", "8", "9", "10","J", "Q", "K", "小", "大"]
        PokerData.setPokerData = function(){
            for (let i = 0; i < PokerData.cardNo.length; i++) {
                if (i < PokerData.cardNo.length - 2) {
                    for (const key in config.pokerCardType) {
                        var pokerDataItem = {
                            showTxt: PokerData.cardNo[i],
                            showType: config.pokerCardType[key]
                        }
                        PokerData.showData.push(pokerDataItem)
                    }
                }else {
                    switch (i) {
                        case 13:
                            var pokerDataItem = {
                                showTxt: PokerData.cardNo[i],
                                showType: Config.ghostCardType.bigG
                            }
                            PokerData.showData.push(pokerDataItem)
                            break;
                        case 14:
                            var pokerDataItem = {
                                showTxt: PokerData.cardNo[i],
                                showType: Config.ghostCardType.smallG
                            }
                            PokerData.showData.push(pokerDataItem)
                            break;
                    }
                }
                
            }
        }
        
    }
}


